getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->once())->method('open') ->with('path', 'name')->willReturn(true); $proxy = new StrictSessionHandler($handler); $this->assertInstanceOf('SessionUpdateTimestampHandlerInterface', $proxy); $this->assertInstanceOf(AbstractSessionHandler::class, $proxy); $this->assertTrue($proxy->open('path', 'name')); } public function testCloseSession() { $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->once())->method('close') ->willReturn(true); $proxy = new StrictSessionHandler($handler); $this->assertTrue($proxy->close()); } public function testValidateIdOK() { $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->once())->method('read') ->with('id')->willReturn('data'); $proxy = new StrictSessionHandler($handler); $this->assertTrue($proxy->validateId('id')); } public function testValidateIdKO() { $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->once())->method('read') ->with('id')->willReturn(''); $proxy = new StrictSessionHandler($handler); $this->assertFalse($proxy->validateId('id')); } public function testRead() { $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->once())->method('read') ->with('id')->willReturn('data'); $proxy = new StrictSessionHandler($handler); $this->assertSame('data', $proxy->read('id')); } public function testReadWithValidateIdOK() { $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->once())->method('read') ->with('id')->willReturn('data'); $proxy = new StrictSessionHandler($handler); $this->assertTrue($proxy->validateId('id')); $this->assertSame('data', $proxy->read('id')); } public function testReadWithValidateIdMismatch() { $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->exactly(2))->method('read') ->withConsecutive(array('id1'), array('id2')) ->will($this->onConsecutiveCalls('data1', 'data2')); $proxy = new StrictSessionHandler($handler); $this->assertTrue($proxy->validateId('id1')); $this->assertSame('data2', $proxy->read('id2')); } public function testUpdateTimestamp() { $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->once())->method('write') ->with('id', 'data')->willReturn(true); $proxy = new StrictSessionHandler($handler); $this->assertTrue($proxy->updateTimestamp('id', 'data')); } public function testWrite() { $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->once())->method('write') ->with('id', 'data')->willReturn(true); $proxy = new StrictSessionHandler($handler); $this->assertTrue($proxy->write('id', 'data')); } public function testWriteEmptyNewSession() { $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->once())->method('read') ->with('id')->willReturn(''); $handler->expects($this->never())->method('write'); $handler->expects($this->once())->method('destroy')->willReturn(true); $proxy = new StrictSessionHandler($handler); $this->assertFalse($proxy->validateId('id')); $this->assertSame('', $proxy->read('id')); $this->assertTrue($proxy->write('id', '')); } public function testWriteEmptyExistingSession() { $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->once())->method('read') ->with('id')->willReturn('data'); $handler->expects($this->never())->method('write'); $handler->expects($this->once())->method('destroy')->willReturn(true); $proxy = new StrictSessionHandler($handler); $this->assertSame('data', $proxy->read('id')); $this->assertTrue($proxy->write('id', '')); } public function testDestroy() { $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->once())->method('destroy') ->with('id')->willReturn(true); $proxy = new StrictSessionHandler($handler); $this->assertTrue($proxy->destroy('id')); } public function testDestroyNewSession() { $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->once())->method('read') ->with('id')->willReturn(''); $handler->expects($this->once())->method('destroy')->willReturn(true); $proxy = new StrictSessionHandler($handler); $this->assertSame('', $proxy->read('id')); $this->assertTrue($proxy->destroy('id')); } public function testDestroyNonEmptyNewSession() { $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->once())->method('read') ->with('id')->willReturn(''); $handler->expects($this->once())->method('write') ->with('id', 'data')->willReturn(true); $handler->expects($this->once())->method('destroy') ->with('id')->willReturn(true); $proxy = new StrictSessionHandler($handler); $this->assertSame('', $proxy->read('id')); $this->assertTrue($proxy->write('id', 'data')); $this->assertTrue($proxy->destroy('id')); } public function testGc() { $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->once())->method('gc') ->with(123)->willReturn(true); $proxy = new StrictSessionHandler($handler); $this->assertTrue($proxy->gc(123)); } } __halt_compiler();----SIGNATURE:----CWSu4tNBHWKFq9kXsHQ+1oFgUfVg7eZsGsaSHRqi2nn4HkDy6wPXIJ/V3tdhq7aTJlXov9luFtIT8VMNGpdG6PnRfFqCG+FWuIPzZgBujhkxWg4/6gfwqtwwbAmYOAbdH9cFE6lCXpWBQoGOi8kyZwhF9orH7m6B/H8SPuocu7PIJG9BMg1HSDffXgs5WgL5DWzNAMr446zcQyXDw6lRv2zssj8PECqUAyKNF96Ijcaj2ae1JsXjA/FqKirh1X3BzLxeUdhGeaV/V29OC3hFH6WDhLISGZqCpvVIKs425tl3r+xi4XFqmBsd0qvc7+R2ipk9ykNiTmTH57zASfU3UIL48sK7SPfMaMlG0Bpj2sBKFbE82UPOrxFMX1emJmUKhGHPbcdPwaCyDNSmK3bZOHWMMCInotBWQj/8boo84WW91MMSQ59IYjtUGK8+kTvbE7EGAX8KAr3uzh1bqlYhPn8PWj4WWjCWNGXJR0gqhwCsUSaT0VxqhAV6Hif/wphz3FOvQs4Io7/tCHQ3OFMMwt3THfUk0UKGBxNWUYaA0zUoB9v6SkPYM8A74Y9j9NAZ0MJSm8mXPUNbXZpVenrAcDvj9gZr2+nF73eGX1m9tFyaDuZpTyLw0HKsqxDpf8+6SC6hY4Esf3/UfBymsgN+6sG1GMQiOa+a34xkXCx6OFg=----ATTACHMENT:----NDY3NDg2OTUwNTgzOTA0OSA2NTMzNTY3OTIyMDA4MzQyIDM3NjgxOTU5OTU4NTAxNzU=